#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QMdiArea>
#include <QPluginLoader>

#include "plugininterface.h"
#include "widgetplugininterface.h"
#include "signalslotplugininterface.h"


class PluginInterface;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void createMenu();
    void createPlugins();

    void loadPlugins();

    QWidget* createWidgetPlugin(QPluginLoader * loader);


    void echoTest();

public slots:
    void addCusMenu(QString menuName);
    void showCusWidget();

    void connectAction();
    void disconnectAction(QAction* act);
    void takeMessage(QString message);
    
private:
    Ui::MainWindow *ui;
    QMdiArea *mdiArea;

    QList<PluginInterface*> pluginList;
    QList<QWidget*> widgetList;
    QList<QPluginLoader* > pluginLoaderList;

private:
    QMenu *fileMenu;
    QList<QMenu*> cusMenuList;

    QWidget* cusWidget;
    QWidget* cusWidgetCpy;
    QAction* cusAction;
    QMdiSubWindow* subWindow;

    bool showWidget;
};

#endif // MAINWINDOW_H
